import { useNavigate } from "react-router-dom"
import { setCityName } from "../store/moudules/city"
import { useDispatch } from "react-redux"


function useCity() {


    const dispatch = useDispatch()
    const navgate = useNavigate()
    const onCityEvent = (cityName) => {
        dispatch(setCityName({ cityName }))
        navgate("/")
    }

    return {
        onCityEvent
    }
}

export default useCity